import React, { Component } from "react";

export default function (ComposedComponent) {
  class Authenticate extends Component {
    componentDidMount() {
      if (!sessionStorage.getItem("token")) {
        this.props.history.push("/login");
      }
    }
    render() {
      return <ComposedComponent {...this.props} />;
    }
  }
  return Authenticate;
}
